package com.wnxy.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wnxy.admin.entity.Recharge;
import com.wnxy.admin.entity.Transaction;
import com.wnxy.admin.mapper.RechargeMapper;
import com.wnxy.admin.service.IRechargeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 充值信息表 服务实现类
 * </p>
 *
 * @author All
 * @since 2023-11-29
 */
@Service
public class RechargeServiceImpl extends ServiceImpl<RechargeMapper, Recharge> implements IRechargeService {

    private final RechargeMapper rechargeMapper;
    public RechargeServiceImpl(RechargeMapper rechargeMapper){
        this.rechargeMapper = rechargeMapper;
    }

    @Override
    public PageInfo<Recharge> getAll(Integer pageNum, Integer pageSize, String keyword) {
        PageHelper.startPage(pageNum, pageSize);

        QueryWrapper<Recharge> wrapper = new QueryWrapper<>();
        if (keyword != null) {
            wrapper.like("recharge_id", keyword);
        }

        List<Recharge> transactions = rechargeMapper.selectList(wrapper);
        return new PageInfo<>(transactions);
    }

    
}
